From e142111567451d4fd8140359d46845bf0faf7871 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 26 Jun 2018 16:59:01 +0100 Subject: [PATCH] Export symbols needed by Android drivers We want to enable use of the Android ashmem and binder drivers to support Anbox, but they should not be built-in as that would waste resources and increase security attack surface on systems that don't need them. Export the currently un-exported symbols they depend on. Gbp-Pq: Topic debian Gbp-Pq: Name export-symbols-needed-by-android-drivers.patch --- fs/file.c | 4 ++++ kernel/fork.c | 1 + kernel/sched/core.c | 1 + kernel/signal.c | 1 + mm/memory.c | 1 + mm/shmem.c | 1 + mm/vmalloc.c | 2 ++ security/security.c | 4 ++++ 8 files changed, 15 insertions(+) diff --git a/fs/file.c b/fs/file.c index 780d29e5884..82dcfd3cf3d 100644 --- a/fs/file.c +++ b/fs/file.c @@ -409,6 +409,7 @@ struct files_struct *get_files_struct(struct task_struct *task) return files; } +EXPORT_SYMBOL_GPL(get_files_struct); void put_files_struct(struct files_struct *files) { @@ -421,6 +422,7 @@ void put_files_struct(struct files_struct *files) kmem_cache_free(files_cachep, files); } } +EXPORT_SYMBOL_GPL(put_files_struct); void reset_files_struct(struct files_struct *files) { @@ -534,6 +536,7 @@ out: spin_unlock(&files->file_lock); return error; } +EXPORT_SYMBOL_GPL(__alloc_fd); static int alloc_fd(unsigned start, unsigned flags) { @@ -607,6 +610,7 @@ void __fd_install(struct files_struct *files, unsigned int fd, rcu_assign_pointer(fdt->fd[fd], file); rcu_read_unlock_sched(); } +EXPORT_SYMBOL_GPL(__fd_install); void fd_install(unsigned int fd, struct file *file) { diff --git a/kernel/fork.c b/kernel/fork.c index 64ef113e387..1fdb37897ea 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1039,6 +1039,7 @@ void mmput_async(struct mm_struct *mm) schedule_work(&mm->async_put_work); } } +EXPORT_SYMBOL_GPL(mmput_async); #endif /** diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d7f409866cd..96ded01da38 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3932,6 +3932,7 @@ int can_nice(const struct task_struct *p, const int nice) return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) || capable(CAP_SYS_NICE)); } +EXPORT_SYMBOL_GPL(can_nice); #ifdef __ARCH_WANT_SYS_NICE diff --git a/kernel/signal.c b/kernel/signal.c index 9102d60fc5c..8365b1f3c5e 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1353,6 +1353,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, return sighand; } +EXPORT_SYMBOL_GPL(__lock_task_sighand); /* * send signal info to all the members of a group diff --git a/mm/memory.c b/mm/memory.c index 5b3f71bcd1a..9b9e1c55593 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1611,6 +1611,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start, mmu_notifier_invalidate_range_end(mm, start, end); tlb_finish_mmu(&tlb, start, end); } +EXPORT_SYMBOL_GPL(zap_page_range); /** * zap_page_range_single - remove user pages in a given range diff --git a/mm/shmem.c b/mm/shmem.c index 3c874265575..bef7be4afba 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4039,6 +4039,7 @@ int shmem_zero_setup(struct vm_area_struct *vma) return 0; } +EXPORT_SYMBOL_GPL(shmem_zero_setup); /** * shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags. diff --git a/mm/vmalloc.c b/mm/vmalloc.c index a46ec261a44..81f3e9062d2 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1299,6 +1299,7 @@ int map_kernel_range_noflush(unsigned long addr, unsigned long size, { return vmap_page_range_noflush(addr, addr + size, prot, pages); } +EXPORT_SYMBOL_GPL(map_kernel_range_noflush); /** * unmap_kernel_range_noflush - unmap kernel VM area @@ -1439,6 +1440,7 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags) NUMA_NO_NODE, GFP_KERNEL, __builtin_return_address(0)); } +EXPORT_SYMBOL_GPL(get_vm_area); struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, const void *caller) diff --git a/security/security.c b/security/security.c index 5ce2448f3a4..b49b5312f76 100644 --- a/security/security.c +++ b/security/security.c @@ -236,24 +236,28 @@ int security_binder_set_context_mgr(struct task_struct *mgr) { return call_int_hook(binder_set_context_mgr, 0, mgr); } +EXPORT_SYMBOL_GPL(security_binder_set_context_mgr); int security_binder_transaction(struct task_struct *from, struct task_struct *to) { return call_int_hook(binder_transaction, 0, from, to); } +EXPORT_SYMBOL_GPL(security_binder_transaction); int security_binder_transfer_binder(struct task_struct *from, struct task_struct *to) { return call_int_hook(binder_transfer_binder, 0, from, to); } +EXPORT_SYMBOL_GPL(security_binder_transfer_binder); int security_binder_transfer_file(struct task_struct *from, struct task_struct *to, struct file *file) { return call_int_hook(binder_transfer_file, 0, from, to, file); } +EXPORT_SYMBOL_GPL(security_binder_transfer_file); int security_ptrace_access_check(struct task_struct *child, unsigned int mode) { -- 2.30.2